Spectral analysis with spectrum deconvolution

ABSTRACT

A method for inferring incident count rates of electromagnetic energy at a detector is provided. In one embodiment, the method includes transmitting electromagnetic radiation through a fluid and receiving a portion of the electromagnetic radiation at a detector. The method also includes measuring the energy spectrum of the portion of the electromagnetic radiation received by the detector and using the measured energy spectrum and a physical model of detector response to electromagnetic radiation to infer incident count rates for discrete energy levels of the portion of the electromagnetic radiation received by the detector. Additional systems, devices, and methods are also disclosed.

CROSS-REFERENCE TO RELATED CASES

This is a continuation of co-pending U.S. patent application Ser. No.16/186,854, filed Nov. 12, 2018, which is a continuation of co-pendingU.S. patent application Ser. No. 15/034,824, filed May 5, 2016, which isa U.S. national stage of International Patent Application Serial No.PCT/US14/64532 filed Nov. 7, 2014, which claims benefit of EuropeanPatent Application Serial No. 13306528.4 filed Nov. 8, 2013, andEuropean Patent Application Serial No. 13306529.2 filed Nov. 8, 2013,each of which is entirely incorporated herein by reference.

BACKGROUND

Wells are generally drilled into subsurface rocks to access fluids, suchas hydrocarbons, stored in subterranean formations. The subterraneanfluids can be produced from these wells through known techniques.Operators may want to know certain characteristics of produced fluids tofacilitate efficient and economic exploration and production. Forexample, operators may want to know flow rates of produced fluids. Theseproduced fluids are often multiphase fluids (e.g., those having somecombination of water, oil, and gas), making measurement of the flowrates more complex.

Various systems can be used to determine flow rates for multiphasefluids. In some systems, multiphase fluids are separated into theirconstituent phases and these phases are then individually tested todetermine flow rates. Other systems include multiphase flow meters thatcan be used to measure flow rates of multiphase fluids withoutseparation. These multiphase flow meters may be smaller and lighter thantraditional separators and test units, and the ability to measure flowrates without separation may be desirable in some instances. Both thetraditional separator systems and the multiphase flow meter systems canalso be used to determine certain other fluid characteristics ofinterest.

SUMMARY

Certain aspects of some embodiments disclosed herein are set forthbelow. It should be understood that these aspects are presented merelyto provide the reader with a brief summary of certain forms theinvention might take and that these aspects are not intended to limitthe scope of the invention. Indeed, the invention may encompass avariety of aspects that may not be set forth below.

In one embodiment of the present disclosure, a method includestransmitting electromagnetic radiation through a fluid and receiving aportion of the electromagnetic radiation at a detector. The method alsoincludes measuring the energy spectrum of the portion of theelectromagnetic radiation received by the detector and using themeasured energy spectrum and a physical model of detector response toelectromagnetic radiation to infer incident count rates for discreteenergy levels of the portion of the electromagnetic radiation receivedby the detector.

In another embodiment, a method of determining phase fractions for amultiphase fluid includes receiving electromagnetic radiationtransmitted through the multiphase fluid and incident on anelectromagnetic radiation detector, as well as transforming the incidentelectromagnetic radiation to electrical signals representative of theincident electromagnetic radiation. The method also includes determiningan energy spectrum from the electrical signals and deconvolving thedetermined energy spectrum to estimate quantities of photons fordifferent energy levels in the electromagnetic radiation that arereceived by the electromagnetic radiation detector. Additionally, themethod includes calculating attenuation coefficients for phases of themultiphase fluid for the different energy levels based on the estimatedquantities of photons of the different energy levels received by theelectromagnetic radiation detector, and determining the phase fractionsfor the phases of the multiphase fluid based on the calculatedattenuation coefficients.

In another embodiment of the present disclosure, an apparatus includes afluid conduit; a radioactive source coupled to the fluid conduit; and asensor coupled to the fluid conduit to receive electromagnetic radiationfrom the radioactive source, measure the energy spectrum of the receivedelectromagnetic radiation, and output data indicative of the measuredenergy spectrum. The apparatus also includes a controller to receive theoutput data from the sensor and to determine, through deconvolution ofthe measured energy spectrum, count rates for photons of differentenergy levels in the electromagnetic radiation received by the sensor.

In still another embodiment, a method includes receiving photons havingdifferent energies at a detector and measuring an energy spectrum of thephotons. Additionally, the method includes using multiple monoenergeticresponse functions to derive spectral components of the energy spectrumfor multiple energy levels of the photons and measuring count rates forenergy levels of the received photons based on the derived spectralcomponents.

In yet another embodiment of the present disclosure, an apparatusincludes a detector of electromagnetic radiation and a multi-channelanalyzer to measure an energy spectrum of electromagnetic radiationreceived by the detector. Further, the apparatus includes a controllerto deconvolve the measured energy spectrum using a physical modelrepresentative of the response of the detector to characterize theelectromagnetic radiation received by the detector.

In an additional embodiment, a method includes modeling a responsefunction of a detector assembly to electromagnetic radiation, thedetector assembly having a scintillation crystal, a photomultipliertube, and an amplifier. Modeling this response function of the detectorincludes determining a crystal response function that relates anelectromagnetic spectrum incident on the scintillation crystal of thedetector assembly to an electromagnetic spectrum deposited in thescintillation crystal. Modeling the response function of the detectoralso includes determining a photomultiplier tube response function thatrelates the electromagnetic spectrum deposited in the scintillationcrystal to a smeared spectrum and determining an amplifier responsefunction that relates the smeared spectrum to an observed spectrum. Theresponse function can be defined as the convolution product of theelectromagnetic spectrum incident on the scintillation crystal, thecrystal response function, the photomultiplier tube response function,and the amplifier response function.

In one embodiment, a method includes transmitting electromagneticradiation from a source through a fluid in a conduit and receiving anattenuated portion of the electromagnetic radiation at a scintillationcrystal of a detector. The method also includes receiving, at aphotomultiplier tube of the detector, light emitted from thescintillation crystal in response to receipt of the attenuated portionof the electromagnetic radiation received at the scintillation crystal;converting the light received at the photomultiplier tube intoelectrical signals; and measuring, based on the electrical signals, anenergy spectrum generated by the attenuated portion of theelectromagnetic radiation. Additionally, the method includes optimizingvariables of a response model for the detector to minimize residualsbetween the measured energy spectrum and an output of the responsemodel. The optimized variables can include incident count rates fordifferent energy levels of photons received by the scintillation crystaland detector-specific parameters.

In a further embodiment, a multiphase flow meter includes a fluidconduit, as well as an emitter and a detector of electromagneticradiation arranged with respect to the fluid conduit so as to enable thedetector to receive photons transmitted from the emitter through a fluidwithin the fluid conduit. The detector can include a scintillator, aphotomultiplier tube, and an amplifier. The multiphase flow meter alsoincludes a multi-channel analyzer coupled to the detector to receiveelectrical signals from the amplifier and output a measured energyspectrum of the photons received by the detector and a flow computerencoded with a response model for the detector. The response model canbe based on characteristics of the emitter and the detector, and theflow computer can compare the measured energy spectrum with the responsemodel to infer count rates for the photons received by the detector.

Additionally, in one embodiment a device includes a non-transitory,computer-readable storage medium encoded with application instructions.When executed by a processor, the application instructions enablereceiving a measured spectrum representative of electromagneticradiation incident on a detector, fitting a modeled spectrum to themeasured spectrum, and determining from the modeled spectrum count ratesfor photons of the electromagnetic radiation incident on the detector.

Various refinements of the features noted above may exist in relation tovarious aspects of the present embodiments. Further features may also beincorporated in these various aspects as well. These refinements andadditional features may exist individually or in any combination. Forinstance, various features discussed below in relation to one or more ofthe illustrated embodiments may be incorporated into any of theabove-described aspects of the present disclosure alone or in anycombination. Again, the brief summary presented above is intended justto familiarize the reader with certain aspects and contexts of someembodiments without limitation to the claimed subject matter.

BRIEF DESCRIPTION OF THE DRAWINGS

These and other features, aspects, and advantages of certain embodimentswill become better understood when the following detailed description isread with reference to the accompanying drawings in which likecharacters represent like parts throughout the drawings, wherein:

FIG. 1 generally depicts an apparatus in the form of a flow meter foranalyzing a fluid in accordance with one embodiment of the presentdisclosure;

FIG. 2 is a block diagram of components of a computer of the apparatusof FIG. 1 in accordance with one embodiment;

FIGS. 3 and 4 generally depict an emitter and a detector ofelectromagnetic radiation positioned about a fluid conduit to enableirradiation of fluid within the conduit and measurement of radiationtransmitted through the fluid in accordance with one embodiment;

FIG. 5 is a block diagram of components of the emitter and detector ofFIGS. 3 and 4 in accordance with one embodiment;

FIG. 6 generally depicts a detector having a scintillation crystal, aphotomultiplier tube, and an amplifier in accordance with oneembodiment;

FIG. 7 is a flow chart for developing a response model for the detectorof FIG. 6 in accordance with one embodiment;

FIGS. 8-13 generally illustrate various interaction effects ofelectromagnetic energy with a scintillation crystal and impacts on thedeposited spectrum;

FIG. 14 depicts electromagnetic emissions of barium-133 at variousenergy levels;

FIG. 15 depicts a simulated crystal response function in accordance withone embodiment;

FIG. 16 generally depicts determination of a crystal impulse responsefor a scintillation crystal in accordance with one embodiment;

FIG. 17 depicts simulated individual spectral responses of ascintillation crystal for various incident energy levels in accordancewith one embodiment;

FIG. 18 generally illustrates additional details of the photomultipliertube of FIG. 6 in accordance with one embodiment;

FIG. 19 depicts deconvolution kernel components based on the individualspectral responses of FIG. 17 in accordance with one embodiment;

FIG. 20 is a block diagram of electronic components of the apparatus ofFIG. 1 in accordance with one embodiment;

FIG. 21 is a graph generally depicting synchronous pulses generated bythe photomultiplier tube in accordance with one embodiment;

FIG. 22 is a flow chart for inferring incident count rates using aphysical model of a detector in accordance with one embodiment;

FIG. 23 is a flow chart for determining phase fractions of a fluidthrough spectrum deconvolution in accordance with one embodiment;

FIGS. 24-27 are examples of spectrum deconvolutions for variousradioactive sources and detector types in accordance with certainembodiments;

FIG. 28 is a flow chart for calculating incident count rates,attenuation, and phase fractions of a fluid in accordance with oneembodiment; and

FIG. 29 is a flow chart for optimizing variables of a detector responsemodel to calculate characteristics of a fluid of interest in accordancewith one embodiment.

DETAILED DESCRIPTION OF SPECIFIC EMBODIMENTS

It is to be understood that the present disclosure provides manydifferent embodiments, or examples, for implementing different featuresof various embodiments. Specific examples of components and arrangementsare described below for purposes of explanation and to simplify thepresent disclosure. These are, of course, merely examples and are notintended to be limiting.

When introducing elements of various embodiments, the articles “a,”“an,” “the,” and “said” are intended to mean that there are one or moreof the elements. The terms “comprising,” “including,” and “having” areintended to be inclusive and mean that there may be additional elementsother than the listed elements. Moreover, any use of “top,” “bottom,”“above,” “below,” other directional terms, and variations of these termsis made for convenience, but does not mandate any particular orientationof the components.

Turning now to the drawings, an apparatus 10 in the form of a flow meteris generally depicted in FIG. 1 in accordance with one embodiment. Whilecertain elements of the apparatus 10 are depicted in this figure andgenerally discussed below, it will be appreciated that the apparatus 10may include other components in addition to, or in place of, thosepresently illustrated and discussed. Moreover, while the apparatus 10may be provided in the form of a flow meter (e.g., a multiphase flowmeter) as described below in connection with certain embodiments, theapparatus 10 could be provided in other forms as well.

As depicted, the apparatus includes a fluid conduit 12 for receiving afluid. The apparatus 10 also includes an emitter 14 of electromagneticradiation, a detector 16 of electromagnetic radiation, a pressure sensor18 (e.g., one or both of a pressure transmitter and adifferential-pressure transmitter), and one or more additional sensors20 (e.g., a temperature sensor). To facilitate certain measurements,such as flow rate, the fluid conduit 12 can have a tapered bore (e.g., aVenturi throat) to constrict fluid flow. Further, in at least oneembodiment the emitter 14 and detector 16 are positioned about a Venturithroat in the fluid conduit 12 such that the detector 16 receivesradiation that has been transmitted through fluid within the Venturithroat.

The apparatus 10 further includes a computer 22 (which may also bevariously referred to as a controller or a control unit) for determiningcharacteristics of fluid within the fluid conduit 12. In at least someembodiments, the computer 22 is provided in the form of a flow computercoupled with the other depicted components in a single unit tofacilitate installation of a flow meter in a larger system (e.g., anoilfield apparatus). More specifically, the computer 22 is operable todetermine characteristics of fluid within the fluid conduit 12 frommeasurements collected by the other components. For example, thecomputer 22 can determine pressure and flow rate of the fluid. Further,a computer 22 of a multiphase flow meter can determine the attenuationof the fluid with respect to various levels of electromagnetic radiationby comparing the amount of radiation emitted from the emitter 14 to theportion of such radiation actually received by the detector 16. Such acomputer 22 can also use this information to calculate phase fractions(e.g., proportions of oil, gas, and water) for a multiphase fluid withinthe fluid conduit 12. Finally, single-phase flow rates can be achievedby combining the phase fraction measurements together with the totalflow rate measurement. Often, a multiphase flow model is implemented tocompensate for differences between the velocities of liquid and gas inthe fluid.

The computer 22 can be a processor-based system, an example of which isprovided in FIG. 2. In this depicted embodiment, the computer 22includes at least one processor 30 connected, by a bus 32, to volatilememory 34 (e.g., random-access memory) and non-volatile memory 36 (e.g.,flash memory and a read-only memory (ROM)). Coded applicationinstructions 38 and data 40 are stored in the non-volatile memory 34.For example, the application instructions 38 can be stored in a ROM andthe data 40 can be stored in a flash memory. The instructions 38 and thedata 40 may be also be loaded into the volatile memory 34 (or in a localmemory 42 of the processor) as desired, such as to reduce latency andincrease operating efficiency of the computer 22. The coded applicationinstructions 38 can be provided as software that may be executed by theprocessor 30 to enable various functionalities described herein.Non-limiting examples of these functionalities include deconvolution ofa measured energy spectrum, determination of incident photon count rateson a detector, and calculation of attenuation rates and phase fractionsfor a fluid. In at least some embodiments, the application instructions38 are encoded in a non-transitory computer readable storage medium,such as the volatile memory 34, the non-volatile memory 36, the localmemory 42, or a portable storage device (e.g., a flash drive or acompact disc).

An interface 44 of the computer 22 enables communication between theprocessor 30 and various input devices 46 and output devices 48. Theinterface 44 can include any suitable device that enables suchcommunication, such as a modem or a serial port. In some embodiments,the input devices 46 include one or more sensing components of theapparatus 10 (e.g., detector 16, pressure sensors 18, other sensors 20)and the output devices 48 include displays, printers, and storagedevices that allow output of data received or generated by the computer22. Input devices 46 and output devices 48 may be provided as part ofthe computer 22 or may be separately provided.

Further, while the computer 22 could be located with the fluid conduit12 and sensing components of the apparatus 10 as a unitary system (e.g.,a flow meter), the computer 22 could also be located remote from theother components. Further, the computer 22 could be provided as adistributed system with a portion of the computer 22 located with thesensing components at the fluid conduit 12 and the remaining portion ofthe computer 22 located remote from the fluid conduit 12.

Additional details regarding operation of the emitter 14 and thedetector 16 may be better understood with reference to FIGS. 3 and 4.The emitter 14 and the detector 16, which may also be referred to ascomponents of a spectrometer or densitometer 50, are arranged about thefluid conduit 12 in any suitable manner that allows the detector 16 toreceive electromagnetic radiation transmitted through fluid within thefluid conduit 12 from the emitter 14. As presently shown, the emitter 14and the detector 16 are coupled opposite one another about the fluidconduit 12. Fluid 52 within the fluid conduit 12 is irradiated withelectromagnetic radiation 54. Some of the electromagnetic radiation 54is absorbed or scattered by the fluid 52, but a portion of theelectromagnetic radiation 54 is received by the detector 16. Windows 56and 58 isolate the emitter 14 and the detector 16 from the fluid 52,while still permitting the electromagnetic radiation 54 to betransmitted from the emitter 14 and received by the detector 16.Particularly, the windows 56 and 58 are at least partially transparentto electromagnetic radiation to be emitted from the emitter 14 and readby the detector 16.

The emitter 14 can produce electromagnetic radiation of any suitablefrequency and energy within the electromagnetic spectrum. For instance,in some embodiments the emitter 14 includes one or more radioactivesources that emit gamma rays and x-rays. Other embodiments could includenon-radioactive emitters 14, such as an electric x-ray generator, infull accordance with the present techniques.

As generally shown in FIG. 4, the emitter 14 and the detector 16 can bepositioned on opposite sides of a Venturi throat 62 in the fluid conduit12. This arrangement allows measurement of the linear attenuationcoefficient, λ_(m)(E), of the fluid 52 for electromagnetic radiation ata given energy E according to the Beer-Lambert law:

${{\lambda_{m}(E)} = {\frac{1}{d}{\ln\left( {{N_{0}(E)}/{N(E)}} \right)}}},$in which d is the throat diameter 64, N(E) is the amount of transmittedphotons (the quantity of photons detected by the detector 16), and N₀(E)is the empty pipe count rates (the quantity of photons emitted from theemitter 14 that would reach the detector 16 but for interference by amedium, such as the fluid 52, in the throat 62).

In some instances, the analyzed fluid can have multiple phases. Forexample, the fluid 52 can be a multiphase fluid having an oily liquidphase, an aqueous liquid phase, and a gaseous phase, which may be moregenerally referred to as oil, water, and gas phases. It will beappreciated by those skilled in the art that the attenuation ofelectromagnetic radiation by a multiphase fluid is a linear combinationof the attenuations caused by each of its phases weighted by theirproportions in the fluid. In the case of a fluid having some combinationof oil, water, and gas, this can be written as:λ_(m)(E)=λ_(g)(E)α_(g)+λ_(w)(E)α_(w)+λ_(o)(E)α_(o),where λ_(g), λ_(w), and λ_(o) are attenuation coefficients for gas,water, and oil for radiation of a given energy level E, and α_(g),α_(w), and α_(o) are respective fractional portions of each phase withinthe analyzed fluid (also referred to herein as phase hold-ups or phasefractions).

This gives as many equations as the number of distinct energy levels inthe electromagnetic radiation from the emitter 14. Further consideringthat the three phase hold-ups sum up to 1, the following system oflinear equations can be achieved:

${\begin{pmatrix}{\lambda_{g}\left( E_{1} \right)} & {\lambda_{w}\left( E_{1} \right)} & {\lambda_{o}\left( E_{1} \right)} \\\vdots & \vdots & \vdots \\{\lambda_{g}\left( E_{n} \right)} & {\lambda_{w}\left( E_{n} \right)} & {\lambda_{o}\left( E_{n} \right)} \\1 & 1 & 1\end{pmatrix} \cdot \begin{pmatrix}\alpha_{g} \\\alpha_{w} \\\alpha_{o}\end{pmatrix}} = \begin{pmatrix}{\lambda_{m}\left( E_{1} \right)} \\\vdots \\{\lambda_{m}\left( E_{n} \right)} \\1\end{pmatrix}$

The attenuation matrix above (i.e., the matrix including thephase-specific attenuation coefficients for n energy levels) can beobtained from full bore measurements on each phase, hereafter called thein-situ references, or theoretical coefficients can be used. Thisattenuation matrix can then be inverted (giving an inversion matrix A⁻¹)to calculate the phase hold-ups:

$\begin{pmatrix}\alpha_{g} \\\alpha_{w} \\\alpha_{o}\end{pmatrix} = {A^{- 1} \cdot \begin{pmatrix}{\lambda_{m}\left( E_{1} \right)} \\\vdots \\{\lambda_{m}\left( E_{n} \right)} \\1\end{pmatrix}}$

The equations above relating the phase attenuations and phase fractionsto the measured attenuation coefficients for the multiphase fluid assumethe energy levels E₁ . . . E_(n) emitted from a source can beindependently measured by the detector. In reality, however, thedetector response is not ideal and some higher-energy photons can beaccounted in lower-energy regions or, conversely, lower-energy photonscan be accounted in higher-energy regions. Due to this mixing ofincident energies, the phase hold-ups can eventually be biased wheninverting the attenuation matrix. Likewise, the detector response maydrift over time because of temperature fluctuations or due to its ownaging. As a consequence, the real-time count rates may differ from thein-situ references (which could have been acquired several days ormonths before, for example). This can also lead to a systematic error onthe phase hold-ups.

To compensate for these two sources of error, each part of the detectionprocess can be modeled. Moreover, rather than recording just certainelectromagnetic emissions and then using an empirical model tocompensate for variance between real and ideal detector response, atleast some embodiments of the present disclosure use the detector 16 tomeasure the full energy spectrum of the electromagnetic radiation 54.And as described in greater detail below, such embodiments can then usea physical model of the response of the detector 16 to determine countrates for photons of different energy levels of interest that areincident on the detector 16. In at least some instances, the measurementof the full energy spectrum and use of the physical model enables thedetection chain of the apparatus 10 to be insensitive to temperature,aging drifts, and source activity variations. These features also allowthe presently disclosed techniques for determining incident count ratesto be broadly applicable to any types of sources, detector technologies,and source-detector geometries.

Additional features of the emitter 14 and the detector 16 are depictedin FIG. 5 as part of a system 70 in accordance with certain embodiments.In this example, the emitter 14 includes a source 72 of electromagneticradiation. As noted above, the source 72 can be a radioactive source,such as barium-133 or americium-241. The selection of the source 72 canbe based on the fluid intended to be analyzed. For instance,americium-241 could be used if the fluid 52 is a wet gas and barium-133could be used in other cases. Fluorescent sources, which generally emitlower-energy spectra than radioactive sources, could also be used. Inaddition to the windows 56 and 58 described above, the system 70includes a collimator 74. The collimator 74 has an opening, such as aslit, that forms a beam of electromagnetic radiation that is directedtoward the scintillator 80. As presently depicted, the collimator 74 ison the detector side of the system, so that electromagnetic radiationtransmitted through the fluid is collimated for receipt by thescintillator 80. This helps filter out scattered photons from theradiation passed to the scintillator 80. But the collimator 74 could beprovided at other positions within the system 70.

The detector 16 is illustrated as a scintillation detector in FIG. 5,though the detector could be a solid-state detector in otherembodiments. As depicted, the detector 16 includes a scintillator 80, aphotomultiplier tube (PMT) 82, and an amplifier 84. The scintillator 80can be provided in various forms, such as a crystal. In someembodiments, the scintillator 80 is a Nal(TI) (sodium iodide doped withthallium) detector or a YAP(Ce) (yttrium aluminum perovskite activatedwith cerium) detector.

The scintillator 80 collects at least a portion of the incident photonenergy it receives and converts this incident energy into radiation in adifferent part of the electromagnetic spectrum. For example, as depictedas part of a detection chain 90 in FIG. 6, high-energy radiation 94(e.g., x-rays and gamma rays) can be absorbed by the scintillator (hereprovided as a scintillation crystal 92) to cause it to radiate pulses oflight 96, such as visible light. The PMT 82, which can be opticallycoupled to the scintillation crystal 92, detects electromagneticradiation (e.g., light 96) emitted from the scintillation crystal 92 andconverts this radiation into electrical charges 98. The amplifier 84then transforms these electrical charges into electrical signals, suchas voltage pulses 100, suitable for analog-to-digital processing.

In at least some embodiments, a physical model of the response of thedetector 16 is created. The physical model can generally include modelsfor each part of a detection chain. This physical model can also bestored in the computer 22 and, as described below, can be used tofacilitate determination of incident count rates at the detector 16 andthe calculation of phase fractions for an analyzed fluid.

One example of a process for creating a physical model of the responseof a scintillation detector is generally represented by flow chart 110in FIG. 7. In this embodiment, the components of the detection chain 90are themselves modeled as response functions that relate inputs at eachcomponent to corresponding outputs. Particularly, as shown in FIG. 7, aresponse function for the scintillation crystal 92 is determined atblock 112, a response function for the PMT 82 is determined at block114, and a response function for the amplifier 84 is determined at block116. It will be appreciated, however, that components of a solid-statedetector could be similarly modeled in another embodiment. Thedetermination of these response functions for a scintillation detectoris described in greater detail below by way of example.

In x-ray and gamma-ray spectroscopy, photons deposit their energy into adetector (e.g., the scintillation crystal 92 or a semiconductor) throughmatter interaction effects, thus generating an energy spectrum. Even byconsidering an ideally perfect deposited-energy-to-electric-signalconversion process resulting in a discrete spectrum, due to the finitesize of the detector the recovered spectrum is continuous: photonsemitted with energy hv have a probability of being measured with smallerenergies. As described in detail below, some embodiments of the presentdisclosure include inferring the number and energy of photons incidenton the detector from a measured spectrum. It should be appreciated thatthe accuracy of such inferences in at least some embodiments will dependon the accuracy of a physical model of the detector response.

Determining the crystal response function at block 112 includesdetermining a crystal impulse response h(e′, e) that relates an incidentspectrum i(e) of the electromagnetic radiation 94 on the scintillationcrystal 92 to a deposited spectrum d(e) inside the scintillationcrystal. As will be appreciated, photons in the electromagneticradiation 94 interact with atoms of the scintillation crystal 92 togenerate light 96. Examples of such interactions are generally describedbelow with reference to FIGS. 8-13. For the sake of simplicity, theseexamples depict photons with energy hv hitting a scintillation crystal92 of finite size. Notable mechanisms of gamma-ray and x-ray interactionwith matter include photoelectric absorption, Compton scattering(incoherent scattering), and, in the case of gamma-rays with energyhv>1.022 MeV, pair production.

In the case of photoelectric absorption generally depicted in FIG. 8,the incident gamma-ray (or x-ray) interacts with an electron of an atomof the scintillation crystal 92 (e.g., an electron of the inner electronshell (K-shell) of the atom) and disappears by giving up its energy hv.An electron (e⁻) is produced from this interaction (i.e., ejected fromthe atom receiving the incident gamma-ray or x-ray) along with either anx-ray photon or a so-called Auger electron following electronrearrangement due to the vacancy left by the ejected electron. Foratomic numbers Z>39, the probability of generating an x-ray photon isgreater than seventy percent and increases with Z. The incident photonenergy is often fully deposited in the detector (as is the case with theupper incident ray in FIG. 8), thus contributing to a full-energy peak126 as depicted in FIG. 9. However, if the effect takes place near thedetector surface, an x-ray photon of energy E_(X) may leave the detector(as is the case with the lower incident ray in FIG. 8). The depositedenergy will then be hv−E_(X), corresponding to a characteristic x-rayescape peak (EP) 128 in the spectrum shown in FIG. 9.

As generally shown in FIG. 10, in the case of Compton scattering theincident gamma-ray (or x-ray) with energy hv interacts with an electronby giving up part of its energy to the electron itself and beingscattered at an angle θ. The portion of energy between the recoilelectron and the scattered photon of energy hv′≤hv depends on thescattering angle θ. When both Compton scattering products deposit theirenergy in the detector (when the scattered photon is eventuallyphotoelectric-absorbed as is the case with the uppermost incident ray inFIG. 10), the incident photon contributes to the full-energy peak 126depicted in FIG. 11. But when the scattered photon leaves the detector(see, e.g., the middle incident ray in FIG. 10), just the recoilelectron energy is deposited. The maximum recoil electron energycorresponds to a head-on collision, i.e., θ=π, and is given by:

$E_{e^{-},{\theta = \pi}} = {hv\frac{2h{v/m_{0}}c^{2}}{1 + {2h{v/m_{0}}c^{2}}}}$In the spectrum of FIG. 11, this is represented by the Compton edge (CE)134 at energy E_(e) ⁻ _(,θ=π) and, for 0≤θ≤π, recoil electrons generateto the so-called Compton continuum 136. Moreover, if a scattered photonescapes the detector after multiple Compton scatterings (see, e.g., thelowermost incident ray in FIG. 10), the deposited energy will be ε<E_(e)⁻ <hv−ε, with ε≅0, thus leading to an extra background overlapping theCompton continuum for energies less than or equal to E_(e) ⁻ _(,θ=π)(which, for the sake of clarity, is not shown in FIG. 11).

Unlike the previous interaction effects, pair production is a thresholdeffect. In such an interaction (two of which are generally depicted inFIG. 12) a gamma-ray with energy hv disappears to create anelectron-positron pair. Since the electron (and positron) rest mass m₀corresponds to an energy of m₀c²=511 keV, the pair creation can takeplace just if hv≥2 m₀c². In some instances, the annihilation photonsfrom positron-electron annihilation (e⁺ are highly unstable particles)deposit their whole energies in the detector, thus contributing to thefull-energy peak 126 in FIG. 13. In other instances, however, either oneor both photons can leave the detector. This leads to the formation ofsingle and double escape peaks 142 and 144 located in the spectrum athv−m₀c² and hv−2 m₀c², respectively.

Escape peak intensities and Compton continuum shape may be empiricallydetermined for emissions at a particular energy level with a givendetector size and hardware geometry. In the more general scenario ofseveral gamma-ray or x-ray emissions of different energies to bedetected, however, such empirical determination becomes increasinglydifficult. Even an analytical approach may not provide desired results.For example, on determining the Compton continuum, the Klein-Nishinaequation does not provide an accurate quantitative description of thecontinuum because, among other things, its free electron hypothesis isunrealistic.

In at least some embodiments of the present disclosure, the complexproblem of incident photon recovery from an energy spectrum isrepresented by Monte Carlo codes, where a combination of nuclear physicsand statistics allows an accurate description of radiation-matterinteractions. The Monte Carlo N-Particle (MCNP) transport code,developed by and available from Los Alamos National Laboratory of theUnited States, is used in at least some embodiments to simulate theresponse of the scintillation crystal 92 to electromagnetic radiation ofdifferent energies, although other codes or algorithms could be used forthis simulation in different embodiments (e.g., Geant 4 from theEuropean Organization for Nuclear Research (CERN)). Once characteristicsof the three-dimensional hardware geometry, the radiation source, andthe detector are introduced, MCNP takes into account detector-relatedeffects and also simulates gamma-ray interactions with materialssurrounding the detector itself. The result is a description of an idealcrystal response function (CRF).

By way of example, FIG. 14 shows an x-ray and gamma-ray emissionspectrum of barium-133 and FIG. 15 illustrates an ideal CRF of a 7-mmthick Nal(TI) scintillation crystal to the barium-133 radiation assimulated by MCNP. Spectral components in both of these figures arelabeled with their respective generation mechanism. Although thespectrum shown in FIG. 15 is single- and double-escape peak free (as themost energetic emission from barium-133 occurs at 383.8 keV, which isless than 2 m₀c²), the cumulative interactive effects due to the finitedetector size make the spectrum complicated, with many high energyphotons sorted in low energy bins.

One embodiment for modeling the impulse response of a scintillationcrystal is generally depicted by flow chart 154 of FIG. 16. In order tosingle out the spectral contribution of each barium-133 emission, theCRF can be simulated for one emission at a time. More specifically,using MCNP 156 and various characteristics 158 of the apparatus (such ascharacteristics of the radiation source, the detector, and thethree-dimensional hardware geometry, as discussed above), monoenergeticresponses for multiple energy levels can be simulated (block 160) togenerate a set of monoenergetic CRFs that characterize the crystalimpulse response 162. The simulation of the monoenergetic responses canbe performed with MCNP or in any other suitable manner. Moreover, asdetailed below, this set of monoenergetic CRFs facilitates laterdetermination of the detector incident photons from a measured spectrum.

As the energy deposition process is an energy-varying linear system, thecrystal response function is fully characterized by its impulse responseh(e′, e). Consequently, the deposited spectrum can be computed from theconvolution product of the incident spectrum with h(e′, e):d(e)=∫i(e′)h(e′,e)de′

This convolution product can also be expressed in a matrix form. If Hdenotes the energy deposition matrix into the scintillation crystal,H_(ij)=h(e_(i), e_(j)), obtained from MCNP (or other) simulations; Irefers to the incident spectrum vector, I_(k)=i(e_(k)); and D denotesthe deposited spectrum vector, D_(k)=d(e_(k)), then the convolutionequation can also be written in discretized form as:D=H·I

The crystal response matrix H contains the individual responses tosource emissions, such as from barium-133 as discussed above. Theseindividual responses of H (for the example of barium-133 sourceemissions) are generally depicted in FIG. 17. Particularly, FIG. 17depicts the simulated spectral responses of the crystal for variousenergy levels of incident electromagnetic radiation corresponding to thegamma-ray and K x-ray spectral components of FIG. 14. In the presentexample, these spectral responses are for ten incident energy levels ofinterest (rounded to the nearest keV): 31 keV, 35 keV, 53 keV, 81 keV,161 keV, 223 keV, 276 keV, 303 keV, 356 keV, and 384 keV. In otherinstances, however, the incident energy levels for which the response issimulated could differ from the preceding example. Further,monoenergetic responses could be simulated for a greater or lessernumber of incident energy levels in accordance with the presenttechniques.

Determining the PMT response function at block 114 of FIG. 7 includesdetermining a PMT response function g(e′, e) that relates the depositedspectrum d(e) to a smeared spectrum s(e). While here described as a PMTresponse function for explanatory purposes, it is noted that asolid-state detector that does not have a PMT could also be similarlymodeled. In the case of solid-state detectors, the smearing effect wouldresult from the charge collection process rather than the electronmultiplication process noted below.

Additional details of a PMT 82 are generally illustrated in diagram 170of FIG. 18 in accordance with one embodiment. As previously noted, thescintillation crystal 92 converts incident radiation 94 into pulses oflight 96, which is measured and converted into electrical signals 98 bythe PMT 82. As depicted in the present figure, photons of light 96 fromthe scintillation crystal 92 fall on a light-sensitive layer in the formof a photocathode 172, causing the photocathode to emit photoelectrons.These photoelectrons are focused electrostatically onto a series ofdynodes 174 that progressively amplify the current associated with theemitted photoelectrons. The amplified signal is collected at an anode176 in the form of current pulses 98 (which can be passed to theamplifier 84 as described above).

Due to the statistical nature of the electron multiplication process ofPMTs, the output charge can vary from one event to the other. Thisuncertainty follows a Poisson process which results in a spectralbroadening (i.e., smearing) of the ideal CRF Dirac peaks. This spectralbroadening can be approximated by a Gaussian filter whose parameterswill depend on the crystal-PMT linearity and resolution. A photondepositing in the crystal the energy e_(j) will be recorded in averageat the channel μ(e_(j)) with a standard deviation σ(e_(j)). These twofunctions (which are energy and resolution response models) are specificto each detector assembly (more specifically, the crystal-PMT assemblyin those embodiments using a crystal scintillator) and can beparameterized the following way or based on any other energyrelationship:μ(e _(j))=p(1)e _(j) +p(2)σ(e _(j))=p(3)√{square root over (e _(j))}+p(4)

In some embodiments, the parameters p(1), p(2), p(3), and p(4) areadjusted continuously in real time to account for temperature or agingdrifts that may occur over a detector's lifetime. In other embodiments,these parameters are adjusted continually, such as periodically at anyspecified frequency (e.g., once per minute).

As it is an energy-varying linear system, the PMT response function isfully characterized by its impulse response g(e′, e). The smearedspectrum can therefore be computed from the convolution product of thedeposited spectrum with g(e′, e):s(e)=∫d(e′)g(e′,e)de′

This convolution product can also be expressed in a matrix form. Forexample, if G(P) is a Gaussian matrix, g_(ij)=g(e_(i), e_(j)), based onthe energy and resolution response models above; D is the depositedspectrum vector, D_(k)=d(e_(k)); and S is the smeared spectrum vector,S_(k)=s(e_(k)), then the convolution equation can be written indiscretized form as:S=G(P)·D

The product matrix G(P)H can be referred to as the deconvolution kernel.This deconvolution kernel characterizes the impulse response of thescintillation crystal 92 and the PMT 82. The deconvolution kernel alsocontains the single energy spectra (components) from which observedspectrums are created. These single energy spectra are generallydepicted in FIG. 19, and it is noted that each depicted spectrum is asmeared version of an associated spectrum depicted in FIG. 17.

Returning again briefly to FIG. 7, determining the amplifier responsefunction at block 116 includes determining an amplifier responsefunction ƒ which relates the smeared spectrum s(e) to an observedspectrum o(e). Each output of the PMT 82 described above is, in essence,an amount of electrical charge proportional to the amount of energy in aphoton (e.g., a gamma-ray or x-ray photon) deposited in thescintillation crystal 92. Electrical components, such as the amplifier84 and a multi-channel analyzer, then collect that charge, measure itsamplitude, and store it in the spectrum.

One example of such components is shown in FIG. 20. In this embodiment,the electrical components include a preamplifier 184, a shapingamplifier 186, and a multi-channel analyzer (MCA) 188. The preamplifier184 and the shaping amplifier 186 may be components of the amplifier 84(FIG. 6), while the MCA 188 can be included as part of the detector 16,part of the computer 22 (e.g., as an input device 46), or as a separatecomponent. The preamplifier 184 converts and amplifies the currentpulses 98 it receives from the PMT 82 into voltage pulses. The shapingamplifier 186 transforms these voltage pulses into linear pulses, suchas unipolar or bipolar semi-Gaussian pulses, having faster baselinerestoration and better signal-to-noise ratio.

The multi-channel analyzer 188 includes analyzer circuitry 190 forsorting the linear pulses into respective channels. The MCA 188 couldinclude any suitable number of measurement channels for sorting linearpulses received from the shaping amplifier 186. For example, in someembodiments the MCA 188 has 512 channels or 1024 channels. When twoincident photons arrive at the detector within the width of the shapingamplifier output pulse, their respective pulses pile up to form anoutput pulse of distorted height, leading to a distorted energyspectrum. While post-processing algorithms may be able to describe theeffect of pulse pile-up on the spectrum in some instances, they can alsobe too resource-intensive (e.g., in CPU processing cycles) for certain(e.g., real-time) implementations.

Accordingly, the depicted MCA 188 includes a pile-up rejector 192. Thispile-up rejector 192 discards pile-up events in which their timeinterval is longer than a threshold pile-up rejection time. Thethreshold pile-up rejection time can be set to any desired level, suchas a level that would result in the discarding of most pile-up events.This can simplify the interpretation of the spectrum distortion bygenerally reducing pile-up effects to the case of synchronous pulses. Inorder to model the distortion due to these left-over synchronous pulses,a quantitative analysis is performed on each channel k of the spectrum.It is possible to demonstrate from Poisson's law that the probability oftwo photons piling-up is:P ₀ =n _(tot)τ exp(−n _(tot)τ),where τ is the pile-up rejection time and n_(tot) is the total countrate.

An example of synchronous pulses is generally represented in the graphof FIG. 21, in which a pulse 200 (with amplitude i) is synchronous witha pulse 202 (with amplitude j), resulting in a cumulative pulse 204 thatwould be read into a channel k due to the summation of i and j. Further,if i and j denote the incident amplitude combinations, the gains andlosses rates can be calculated for each channel k via the followingformula:

$G_{k} = {n_{tot}{\sum\limits_{i = 1}^{k - 1}{P_{i}P_{k - i}P_{0}}}}$$L_{k} = {2n_{tot}{\sum\limits_{i = 1}^{n_{tot}}{P_{i}P_{k}P_{0}}}}$${{with}\mspace{14mu} P_{k}} = \frac{S_{k}}{n_{tot}}$

The observed spectrum is then a balance of gains and losses in eachchannel:O _(k) =f(S _(k))=S _(k) −L _(k) +G _(k)

Each part of the detection chain has been modeled above in the form ofindividual response functions. The global detector response can beconsidered a physical model that combines those individual responsefunctions to represent the functioning of the modeled detector chain.Consequently, this global detector response can be expressed in matrixform as:O=f(G(P)HI)

In at least some embodiments, this physical model for detector responseis used to infer incident count rates for photons of different energylevels received by the detector 16. The inferred count rates can then beused to determine characteristics of an analyzed fluid. One example of aprocess for inferring the incident count rates and then characterizing afluid based on the inferred count rates is generally represented by flowchart 210 in FIG. 22. In this embodiment, electromagnetic radiation(e.g., x-rays and gamma rays from emitter 14) is transmitted (block 212)through a fluid of interest. The fluid attenuates the radiation suchthat a portion of the radiation is received (block 214) at a detector(e.g., detector 16). At block 216, the energy spectrum of the radiationreceived by the detector is measured, which may be performed by amulti-channel analyzer such as that described above. In at least someinstances, the full energy spectrum of the received radiation ismeasured. In others, a partial energy spectrum can be measured, such asa portion of the energy spectrum falling within a contiguous range ofmultiple channels of a multi-channel analyzer. But it is noted that, asused herein, measurement of the energy spectrum (whether a full energyspectrum or a partial energy spectrum) means measurement of countswithin numerous channels of a multi-channel analyzer, rather than merelymeasuring counts in a handful of channels (e.g., two to ten channelsisolated from one another) corresponding to particular energy levels ofinterest. This measurement of the spectrum, rather than of a smallnumber of individual channels, allows incident count rates to beinferred from the measured energy spectrum in accordance with thepresent techniques.

At block 218, the measured energy spectrum and the physical model fordetector response are used to infer variables of the physical model. Forthe model described above, inputs of the model include crystalmonoenergetic responses H and the detector energy and resolutionfunctions μ(e) and σ(e), and the variables include the incident countrates for photons of different energy levels and the detector-specificparameters p(1), p(2), p(3), and p(4). These variables can be inferredthrough a deconvolution process based on the detector response functionO.

More specifically, in at least some instances the detector responsefunction of the physical model is compared to the measured energyspectrum, which may include performing optimization (e.g., least squaresoptimization) on the detector response function to fit the detectorresponse function to the measured energy spectrum and infer the incidentcount rates and detector-specific parameters. For example, letting Y bethe measured spectrum, a non-linear least squares algorithm can be usedto determine the detector-specific parameters P and the incident countrates I that minimize the following residuals:

$\left. {\frac{Y - O}{\sigma_{Y}}}^{2}\Leftrightarrow{\frac{Y - {f\left( {{G(P)}HI} \right)}}{\sqrt{Y}}}^{2} \right.$The residuals can be weighted by the standard deviation of themeasurements, i.e., the square root of counts in this case sincecounting processes are ordinarily assumed to follow Poisson statistics.A Levenberg-Marquardt algorithm can be used to perform the optimization(in the form of least squares minimization) or a simpler Gauss-Newtontechnique can be used. Still further, maximum likelihood or maximumentropy methods can be used to perform the optimization, as can anyother suitable methods.

Once the incident count rates I are inferred, these count rates can becompared with empty pipe count rates to determine the attenuation ofelectromagnetic radiation by the analyzed fluid for multiple energylevels, as described above with respect to FIG. 4. The determinedattenuation can then be used to characterize the fluid (block 220), suchas by determining phase fractions for the fluid or information aboutsome additional component, such as hydrogen sulfide or salts in thefluid, as discussed below. Further, the inferred detector-specificparameters P can be used to calibrate the detector (block 222), such asto maintain the spectral output of the detector at a reference position.

In accordance with another embodiment, a process for determining phasefractions of a multiphase fluid is generally represented by flow chart230 in FIG. 23. In this embodiment, electromagnetic radiation is emitted(block 232) through a multiphase fluid. For instance, a radioactivesource can emit x-rays and gamma rays into a multiphase fluid flowingthrough a fluid conduit. The radiation incident on a detector isreceived (block 234) and transformed (block 236) into electrical signalsas described above. It will be appreciated that the electrical signalsare representative of the incident radiation.

An energy spectrum is determined (block 238) from the electrical signalsand then deconvolved (block 240) to estimate quantities of photons ofmultiple energy levels received by the detector. The deconvolution ofthe determined energy spectrum (which in at least some instances is thefull energy spectrum of the received radiation) can be performed in anysuitable manner, such as by fitting a modeled detector response functionin the manner described above. Attenuation coefficients for the fluidcan be calculated (block 242) and phase fractions can be determined(block 244) based on the attenuation coefficients as described elsewhereherein. The phase fractions in some embodiments include gas, water, andoil phases. Further, the phase fractions could include other componentsin addition to (or in place of) gas, water, and oil. Still further,information about additional components, such as hydrogen sulfide orsalts, could also be determined, as described below.

Examples of spectrum deconvolutions for various radioactive sources anddetector types are generally depicted in FIGS. 24-27. In each of theseexamples, the deconvolution kernel is computed from MCNP simulationsbased on input characteristics of the radioactive source, the detector,and source-detector geometry. Further, each of these graphs depictsincident photon counts (y-axis) over 512 channels (x-axis). In additionto a measured spectrum, an observed spectrum, and a smeared spectrum,individual spectral components associated with energy lines of therespective radioactive source are also depicted (with the source energylines enumerated in keV in at the bottom of each of these figures). Thedata depicted in FIG. 24 is based on a barium-133 radiation source and a10 mm YAP(Ce) scintillation crystal. In FIG. 25, the depicted data isalso based on a barium-133 radiation source, but with a 2 mm YAP(Ce)scintillation crystal. In FIG. 26, the depicted data is based on anamericium-241 radiation source and a 10 mm YAP(Ce) scintillator. And thedata in FIG. 27 is based on radiation source having cesium-137 andsodium-22 with a 25.4 mm (one-inch) YAP(Ce) scintillation crystal.

A further example of a process for calculating incident count rates,attenuation, and phase fractions of a fluid is generally represented byflow chart 250 in FIG. 28. In this embodiment, photons of differentenergies that have passed through a fluid of interest (e.g., amultiphase fluid in a conduit) are received at a detector (block 252)and the energy spectrum of the received photons is then measured (block254). Spectral components of the measured energy spectrum are derived(block 256) for multiple energy levels of the photons received by thedetector. These spectral components can be derived in any suitablemanner, including using multiple monoenergetic response functions in themanner described above. Count rates can then be measured (block 258) forat least two energy levels of the received photons based on the derivedspectral components. The at least two energy levels can include anyenergy levels of interest. For example, the received photons can includex-ray photons and gamma-ray photons, and the at least two energy levelscan include a first energy level for received x-ray photons and a secondenergy level for received gamma-ray photons. In some embodiments, suchas those using a barium-133 source, the first energy level of receivedx-ray photons is between 30 keV and 36 keV and the second energy levelof received gamma-ray photons is between 79 keV and 81 keV. Attenuationrates of the photons by the fluid for the at least two energy levels andphase fractions for the fluid can then be calculated at blocks 260 and262 in any suitable manner.

Additionally, an example of a process that optimizes variables of adetector response model to enable calculation of fluid characteristicsis generally represented by flow chart 270 in FIG. 29. In thisembodiment, electromagnetic radiation is transmitted through a fluid(block 272) and an attenuated portion of that radiation is received at ascintillation crystal of a detector (block 274). The scintillationcrystal emits light in response to the received radiation, and thislight is received by a photomultiplier tube (block 276). The light isconverted to electrical signals (block 278) to enable measurement of theenergy spectrum generated by the radiation received at the scintillationcrystal (block 280). Variables of a detector response model can then beoptimized, as described above, to minimize residuals between themeasured energy spectrum and an output of the detector response model(block 282). The optimized variables of the detector response model caninclude incident count rates for different energy levels of photonsreceived by the scintillation detector and detector-specific parameters,as also described above. In some embodiments, the residuals are weightedbased on a standard deviation of the measured energy spectrum and thevariables are optimized with a non-linear, least squares algorithm, suchas a Levenberg-Marquardt algorithm or a Gauss-Newton algorithm. Further,attenuation coefficients of the fluid for the different energy levels ofradiation and phase proportions (e.g., for water, oil, and gas) can becalculated (blocks 284 and 286).

While the present techniques can be used to determine fractionalportions for a multiphase fluid having three components (e.g., oil,water, and gas), they can also be used to determine additionalcomponents of the multiphase fluid. In some instances, the presenttechniques can be applied to cases of fluids having a combination ofhydrocarbon liquid (e.g., oil), water, hydrocarbon gas, and someadditional component, e.g., hydrogen sulfide or salts. With the presenttechniques, count rates from distinct energy levels in theelectromagnetic radiation from the emitter 14 can be inferred. This cangive as many equations as the number of the energy levels, thusproviding a system of linear equations that can be inverted to calculatethe fractional components of oil, water and gas as well as furtherinformation related to additional components, for instance in the formof change of salt and hydrogen sulfide quantity. The equations regardingthe additional components will involve count rates of extra energylevels as well as other physical quantities depending on the chemicalbehavior of the additional components with oil, water and gas.

The foregoing outlines features of several embodiments so that thoseskilled in the art may better understand aspects of the presentdisclosure. Those skilled in the art should appreciate that they mayreadily use the present disclosure as a basis for designing or modifyingother processes and structures for carrying out the same purposes orachieving the same advantages of the embodiments introduced herein.Those skilled in the art should also realize that such equivalentconstructions do not depart from the spirit and scope of the presentdisclosure, and that they may make various changes, substitutions andalterations herein without departing from the spirit and scope of thepresent disclosure.

The invention claimed is:
 1. A method comprising: emitting x-ray andgamma radiation into a fluid; receiving photons of the x-ray and gammaradiation transmitted through the fluid having different energies at adetector; physically modelling the detector by determining a detectorresponse function based on characteristics of the detector, andanalyzing the fluid based on the photons received at the detector,wherein analyzing the fluid includes: measuring an energy spectrum ofthe photons; and inferring incident count rates by fitting the measuredspectrum with a modelled spectrum, the modelled spectrum being thedetector response function applied to an incident spectrum.
 2. Themethod of claim 1, wherein receiving the photons at the detectorincludes receiving photons that have passed through a multiphase fluidin a conduit.
 3. The method of claim 2, comprising: calculatingattenuation rates of the photons by the multiphase fluid for the atleast two energy levels; and calculating phase fractions of themultiphase fluid using the calculated attenuation rates.
 4. The methodof claim 1, wherein inferring incident count rates includes inferringcount rates for a first energy level of received x-ray photons and asecond energy level of received gamma-ray photons.
 5. The method ofclaim 4, wherein the first energy level of received x-ray photons isbetween 30 keV and 36 keV.
 6. The method of claim 4, wherein the secondenergy level of received gamma-ray photons is between 79 keV and 81 keV.7. The method of claim 1, wherein receiving the photons at the detectorincludes receiving the photons at a scintillator of the detector.
 8. Themethod of claim 1, wherein determining a detector response functionbased on the detector characteristics comprises determining a set ofcrystal monoenergetic response functions based on detectorcharacteristics and determining the detector response function based onthe set of crystal monoenergetic response functions.
 9. A multiphaseflow meter comprising: a fluid conduit; an emitter and a detector ofelectromagnetic radiation including x-rays and gamma rays, the emitterand the detector arranged with respect to the fluid conduit so as toenable the detector to receive photons transmitted from the emitterthrough a fluid within the fluid conduit, wherein the detector includesa detection chain having a scintillator, a photomultiplier tube, and anamplifier; a multi-channel analyzer coupled to the detector to receiveelectrical signals from the amplifier and output a measured energyspectrum of the photons received by the detector; and a flow computerconfigured to physically model the detector by determining a detectorresponse function based on characteristics of the detector, wherein theflow computer is configured to analyze the fluid, such analysisincluding inferring incident count rates by fitting the measuredspectrum with a modelled spectrum, the modelled spectrum being thedetector response function applied to an incident spectrum.
 10. Themultiphase flow meter of claim 9, wherein the flow computer isconfigured to infer the count rates for the photons received by thedetector in real time.
 11. The multiphase flow meter of claim 9, whereinthe flow computer is configured to calculate phase fractions for thefluid within the fluid conduit in real time.
 12. The multiphase flowmeter of claim 9, comprising a pressure sensor, wherein the flowcomputer is configured to determine a flow rate for the fluid.
 13. Themultiphase flow meter of claim 9, wherein the emitter includes aradioactive source of electromagnetic radiation.
 14. The multiphase flowmeter of claim 9, wherein the emitter includes an electric x-raygenerator.
 15. The multiphase flow meter of claim 9, wherein the flowcomputer is further configured to determine a set of crystalmonoenergetic response functions based on characteristics of thedetector and determine the detector response function based on the setof crystal monoenergetic response functions.
 16. A method comprising:transmitting electromagnetic radiation through a fluid, theelectromagnetic radiation including x-ray and gamma radiation; receivinga portion of the electromagnetic radiation transmitted through the fluidat a detector comprising a detection chain of components; and analyzingthe fluid based on the portion of the electromagnetic radiation receivedat the detector, wherein analyzing the fluid includes: measuring theenergy spectrum of the portion of the electromagnetic radiation receivedby the detector; and using the measured energy spectrum and a physicalmodel of detector response to electromagnetic radiation to inferincident count rates for discrete energy levels of the portion of theelectromagnetic radiation received by the detector, the physical modelincluding a detector response function that is based on physicalcharacteristics of the detector.
 17. The method of claim 16, wherein thedetector response function is also based on a component responsefunction for each of a plurality of components of the detection chainthat relates inputs at the component to corresponding outputs.
 18. Themethod of claim 16, wherein inferring the incident count rates isperformed by optimization to fit a modeled spectrum with the measuredenergy spectrum, the modelled spectrum being the detector responsefunction applied to an incident spectrum.
 19. The method of claim 18,wherein optimization includes performing least squares optimization. 20.The method of claim 19, wherein the physical model of detector responseincludes models having detector-specific parameters, and the methodcomprises inferring the detector-specific parameters from the leastsquares optimization.
 21. The method of claim 20, further comprisingcalibrating the detector based on the inferred detector-specificparameters.
 22. The method of claim 16, further comprisingcharacterizing a physical attribute of the fluid based on the inferredincident count rates.
 23. The method of claim 22, wherein the fluid is amultiphase fluid and characterizing a physical attribute of the fluidincludes determining phase fractions for the multiphase fluid.
 24. Anapparatus comprising: an emitter and a detector of electromagneticradiation configured to emit or detect, respectively, x-rays and gammarays; a multi-channel analyzer configured to measure an energy spectrumof electromagnetic radiation received by the detector; and a controllerconfigured to analyze a fluid through which the electromagneticradiation is passed from the emitter to the detector, wherein suchanalysis includes deconvolving the measured energy spectrum using aphysical model representative of the response of the detector tocharacterize the electromagnetic radiation received by the detector,wherein the physical model includes a detector response function that isbased on physical characteristics of the detector and on a componentresponse function for each of a plurality of components of a detectionchain of the detector that relates inputs at each component tocorresponding outputs.
 25. The apparatus of claim 24, wherein thecontroller is configured to determine count rates for photons incidenton the detector based on the deconvolution of the measured energyspectrum.
 26. The apparatus of claim 24, wherein the detector is asolid-state detector.
 27. The apparatus of claim 24, comprising amultiphase flow meter having the detector, the emitter, themulti-channel analyzer, and the controller.
 28. The apparatus of claim27, wherein the controller is a flow computer configured to calculatephase fractions of the fluid passing through the multiphase flow meterbased on the deconvolution of the measured energy spectrum using thephysical model representative of the response of the detector.
 29. Theapparatus of claim 24, wherein the detector includes a shaping amplifierfor providing to the multi-channel analyzer output pulses indicative ofphotons received by the detector.
 30. The apparatus of claim 29, whereinthe multi-channel analyzer includes a pile-up rejector.